<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>登录</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="{{ URL::asset('admin/assets/i/favicon.png') }}">
    <link rel="apple-touch-icon-precomposed" href="{{ URL::asset('admin/assets/i/app-icon72x72@2x.png') }}">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="{{ URL::asset('admin/assets/css/amazeui.min.css') }}" />
{{--    <link rel="stylesheet" href="{{ URL::asset('admin/assets/css/amazeui.datatables.min.css') }}" />--}}
    <link rel="stylesheet" href="{{ URL::asset('admin/assets/css/app.css') }}">
    <script src="{{ URL::asset('admin/assets/js/jquery.min.js') }}"></script>

</head>

<body data-type="login" style="background: #f1f2f7;">
    <div class="am-g tpl-g">
        <div class="tpl-login">
            <div class="tpl-login-content">
				<div style="color:#333;font-size: 20px;text-align: center;margin-bottom: 50px;">
                    云盘后台管理系统
				</div>
                <form class="am-form tpl-form-line-form">
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="username" placeholder="请输入账号">
                    </div>
                    <div class="am-form-group">
                        <input type="password" class="tpl-form-input" id="userpwd" placeholder="请输入密码">
                    </div>
                    {{--<div class="am-form-group tpl-login-remember-me">
                        <input id="remember-me" type="checkbox">
                        <label for="remember-me">
                        记住密码
                         </label>
                    </div>--}}
                    <div class="am-form-group">
                        <button type="button" id="submit" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="{{ URL::asset('admin/assets/js/amazeui.min.js') }}"></script>
    <script src="{{ URL::asset('admin/assets/js/app.js') }}"></script>
<script>
    $('#submit').click(function () {
        var data = {};
        data.user_name = $('#username').val();
        data.password = $('#userpwd').val();

        if(data.user_name == ''){
            alert("请输入用户名");
            return false;
        }else if(data.password == ''){
            alert("请输入密码");
            return false;
        }else if($('#role').val() == ''){
            alert("请选择登录身份");
            return false;
        }

        var url = '/dashboard/login';

        $.ajax({
            type: 'post',
            url: url,
            dataType: 'json',
            data:data,
            async:false,
            success: function (result) {
                if (result.code == 0) {
                    alert("登录成功!");
                    location.href = '/dashboard';
                }else{
                    alert("用户名或密码不正确!");
                    location.href = location.href;
                }
            }
        });
    });
</script>
</body>

</html>